package leader.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import leader.service.DirectPaperService;
import teacher.bean.Flow;
import teacher.bean.Paper;
import teacher.service.flow;
import teacher.service.paper;

public class DirectPaperCheckAction {
	private Paper paper;

	public Paper getPaper() {
		return paper;
	}

	public void setPaper(Paper paper) {
		this.paper = paper;
	}
	public String execute() {
		System.out.println(paper.getPapId());
		paper.setState(4);
		DirectPaperService DS = new DirectPaperService();
		DS.updatePaperState(paper);
		
//		流程管理开始
		Paper a=new Paper();
		a=new paper().SelectPaperById(paper);
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getPapId());
		f.setFruitKind(1);
		f.setDirDo(0);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(2);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return "success";
		}else{
			return "success";
		}
	}
}
